<!DOCTYPE html>
  <html>
  <head>
      <meta charset="utf-8">
      <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
      <title>个人中心</title>
      <link rel="stylesheet" type="text/css" href="../../css/api.css" />
      <link rel="stylesheet" type="text/css" href="../../css/common.css" />
      <link rel="stylesheet" type="text/css" href="../../css/aui.css" />
    	<link rel="stylesheet" type="text/css" href="../../css/aui-pull-refresh.css" />
      <style>
          html, body {width: 100%;min-height: 100%;background: #F3EFEE;}
          .aui-active .aui-bar-tab-label{
            color: #f5a51c
          }
          .login {height:240px;background-image: -webkit-linear-gradient(0deg, #f5c674, #ed824c);/*background-image: url(../../image/personal_bkg.jpg);background-repeat: no-repeat; background-size: cover;*/position: relative;}
      	.login .personal_logo {width: 4rem;height: 4rem;border-radius: 50%;margin: 0 auto 9px;/*position: absolute; top: 60px; left: 20px;*/}
      		.login .userinfo {position: absolute; top: 60px;text-align: center; left: 0; right: 0;}
      		.login .userinfo .title {font-size: 0.8rem; color: #fff;}

      		/* 设置条目 */
      		.item {height: 3rem;line-height: 3rem;padding-left: 0.7rem;background-color: #fff;}
      		.item_ico {float: left;width: 2.3rem;padding: 0.7rem 0.7rem 0.7rem 0;}
      		.item_arrow {float: right;width: 1.5rem;padding: 1rem 0.7rem 1rem 0;}
      		.item span {font-size: 0.7rem;}
          [v-cloak] {
              display: none;
          }
          .aui-toast-content{
            color: #fff;
          }
          .aui-radio{
            width: 1rem !important;
            height:1rem !important;
            margin-right: 0.2rem
          }
          .zfmm{
            display: none !important;
          }
      </style>
  </head>
  <body>

<div id="app" v-cloak>
  <div class="user_nav_line"></div>

  <div class="aui-refresh-content">
    <div class="aui-content aui-margin-b-15">
      <ul class="aui-list aui-form-list">

        <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">
                        金额
                    </div>
                    <div class="aui-list-item-input">
                        {{dataInfo.service_charge}} 元 / 年
                    </div>
                </div>
        </li>
        <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">
                    支付方式
                    </div>
                    <div class="aui-list-item-input">
                        <div ><label style="float:left"><input class="aui-radio" type="radio" name="zftype" v-mode="zftype" value="2" @click="setZFType(2)" checked> </label><img src="../../image/my/m42.png" width="25" style="float:left" /> &nbsp;&nbsp;支付宝</div>
                    </div>
                </div>
        </li>
        <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">

                    </div>
                    <div class="aui-list-item-input">
                        <div ><label style="float:left"><input class="aui-radio" type="radio" name="zftype" v-mode="zftype"  value="3" @click="setZFType(3)"> </label> <img src="../../image/my/m41.png" width="25" style="float:left" /> &nbsp;&nbsp;微信支付</div>
                    </div>
                </div>
        </li>
        <li class="aui-list-item">
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">

                    </div>
                    <div class="aui-list-item-input">
                        <div ><label style="float:left"><input class="aui-radio" type="radio" name="zftype" v-mode="zftype" value="4" @click="setZFType(4)"> </label>余额</div>
                    </div>
                </div>
        </li>

        <li class="aui-list-item zfmm" >
                <div class="aui-list-item-inner">
                    <div class="aui-list-item-label">
                    支付密码
                    </div>
                    <div class="aui-list-item-input">
                        <input type="password" placeholder="请输入支付密码" v-model="zfmm">{{zfmm}}
                    </div>
                </div>
        </li>



      </ul>
    </div>

  </div>



<footer class="aui-bar aui-bar-tab" id="footer">
  <div class="aui-btn aui-btn-warning aui-btn-block" @click="sendDataInfo()">立即续费</div>
</footer>

</div>

  </body>
  <script type="text/javascript" src="../../script/api.js"></script>
  <script type="text/javascript" src="../../script/zepto.js"></script>
  <script type="text/javascript" src="../../script/vue.min.js"></script>
  <script type="text/javascript" src="../../script/utils.js"></script>
  <script type="text/javascript" src="../../script/common.js"></script>
  <script type="text/javascript" src="../../script/aui-tab.js"></script>
  <script type="text/javascript" src="../../script/aui-scroll.js"></script>
  <script type="text/javascript" src="../../script/aui-pull-refresh.js"></script>
  <script type="text/javascript" src="../../script/aui-popup.js"></script>
  <script type="text/javascript" src="../../script/aui-toast.js"></script>

  <script>
  apiready = function(){
    var toast = new auiToast({})
    new Vue({
      el:'#app',
      data:{
        dataInfo:{},
        zfmm:'',
        zftype:2
      },
      methods:{
        getDataInfo(){
          var _this = this;
          api.ajax({
              url: window.Url.Freestore_serviceCharge,
              method: 'post',
              data: {
                  values: {
                      token:$api.getStorage("token")
                  }
              }
          },function(ret, err){
              if (ret.re == 1) {
                  _this.dataInfo = ret.data;
              } else {
                toast.loading({
                        title:ret.info,
                        duration:1000
                  },function(ret1){
                    //toast.hide();
                    //api.closeWin();

                    console.log(ret1)
                    setTimeout(function(){
                        toast.hide();
                        api.closeWin();
                    }, 1000)

                  });
              }
          });
        },
          sendDataInfo(){
            var _this = this;
            _this.zftype = $('input[name="zftype"]:checked').val();
            if(_this.zftype == 4){
              if(_this.zfmm == ""){
                toast.fail({
                    title:"请输入支付密码",
                    duration:2000
                });
              }
            }



            api.ajax({
                url: window.Url.Freestore_serviceRecharge,
                method: 'post',
                data: {
                    values: {
                        token:$api.getStorage('token'),
                        bankId:0,
                        password:_this.zfmm,
                        type:_this.zftype
                    }

                }
            },function(ret, err){
              console.log(JSON.stringify(err))
              return;
                if (ret) {
                  if(ret.re == 1){
                    _this.dataInfo = ret;

                  }
                  else{
                    var info = ret.info;
                    toast.loading({
                            title:ret.info,
                            duration:1000
                      },function(ret1){

                        //toast.hide();
                        //api.closeWin();

                        console.log(ret1)
                        setTimeout(function(){
                            toast.hide();
                            //api.closeWin();
                        }, 1000)

                      });
                  }
                } else {
                    console.log( JSON.stringify( err ) );
                }
            });

          },
          setZFType(k){

            if(k == 4){
              $(".zfmm").css("display","block !important")
            }
            else{
              $(".zfmm").css("display","none !important")
            }


          }
          ,
        setRefresh() {
          let _this = this;
              let pullRefresh = new auiPullToRefresh({
                  container: document.querySelector('.aui-refresh-content'),
                  triggerDistance: 100
              }, function(ret) {
                  _this.personMsg();
                  if (ret.status == "success") {
                      setTimeout(function() {
                          pullRefresh.cancelLoading(); //刷新成功后调用此方法隐藏
                      }, 1500)
                  }
              })
          }

      },

      mounted(){
        var _this = this;
        this.setRefresh();
        this.getDataInfo();




      },
      updated(){


      }

    })
  }
  </script>
  </html>
